﻿using System;
using System.ComponentModel;

namespace Brjnk.GpxExplorer.Data
{
    public abstract class GeocacheLog : INotifyPropertyChanged, ICloneable
    {
        public abstract DateTime Date { get; set; }

        public abstract string Type { get; set; }

        public abstract string Finder { get; set; }

        public abstract string Text { get; set; }

        public T ConvertTo<T>() where T : GeocacheLog
        {
            var instance = Activator.CreateInstance(typeof(T)) as GeocacheLog;
            instance.Date = Date;
            instance.Type = Type;
            instance.Finder = Finder;
            instance.Text = Text;
            return instance as T;
        }

        public event PropertyChangedEventHandler PropertyChanged;

        protected void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }

        public abstract object Clone();
    }
}